using System;
using System.Collections.Generic;
using System.Text;
using TaugeLibrary.Classes.Abstracts;
using TaugeLibrary.Enums;
using TaugeLibrary.Classes.Attributes;
using TaugeLibrary.Interfaces;

namespace TaugeFramework.BusinessUnit.Test
{

    [AttTable("Test")]
    [AttPrimaryKey("TestId")]
    [AttUniqueKey("TestCode")]        
    public class TestBU:ABusinessUnit
    {
        int m_test_id=0;
        string m_test_code="";
        string m_test_description="";

        public TestBU(ITaugeFramework p_framework):base(p_framework) { }
        

        [AttField("TestId", eDBDataType.IDENTITY, 0,"Id")]
        [AttBindControl(eControlType.PROPERTY, "Id")]                
        public int TestID { set { m_test_id = value; } get { return m_test_id; } }

        [AttField("TestCode", eDBDataType.VARCHAR, 10,"Kode Test")]
        [AttBindControl(eControlType.TEXTBOX, "txtCode")]                
        [AttSearchable]
        [AttKeyField]
        public string TestCode { set { m_test_code = value; } get { return m_test_code; } }

        [AttField("TestDescription", eDBDataType.VARCHAR, 250, "Keterangan")]
        [AttBindControl(eControlType.TEXTBOX, "txtDescription")]
        [AttSearchable]
        public string TestDescription { set { m_test_description = value; } get { return m_test_description; } }


    }
    [AttBuMgr(
        UnitName = "User",
        //ListSql = "SELECT UserId, Username, UserDesc AS Keterangan, EmailAddr AS Email, CASE WHEN UserType=1 THEN 'GROUP' ELSE 'USER' END AS Tipe, IsActive AS Aktif FROM UserAccount WHERE 1<>2 ",
       Unit = "TaugeFramework.BusinessUnit.Test.TestBU",
       UnitUI = "TaugeFramework.BusinessUnit.Test.TestBUUI",
        ImageRes = "User",
        DllFile = "TaugeFramework.exe",
        ListIsDistinct = false,
        ListColumns = new string[] { "Test.TestId AS Id", "Test.TestCode AS [Kode Test]", "Test.TestDescription AS Keterangan" },
        ListTables = new string[] { "Test" },
        ListKeys = new string[] { "Id" },
        ListOrders = new string[] { "Test.TestId" }
       // , ListHiddenColumns = new string[] { "Id" }
   )]
    public class TestBUManager : ABusinessUnitManager
    {
        public TestBUManager() : base(Program.Framework) { }
    }

}
